<template>
  <span>
    <span v-if="row.listName === '白'">已添加，</span><ElButton v-if="visible" :="attrs" @click="emit('click')">
      {{ row.listName === '白' ? '取消' : '添加' }}
    </ElButton>
  </span>
  
</template>

<script setup lang="ts">
import { useAttrs, computed } from 'vue'
const attrs = useAttrs()

interface Props {
  row?: any;
  auths: Set<string>;
  auth: null | string;
}
const props = withDefaults(defineProps<Props>(), {
  auth: null,
  auths: () => new Set(),
  row: () => ({})
})

const emit = defineEmits(['click'])

const visible = computed(() => {
  return !props.auth || props.auths.has(props.auth)
})

defineExpose({
  auth: props.auth
})
</script>
